<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>点击事件的修饰符</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>

<body>
    <div id='app'>
        <!-- 阻止单击事件冒泡 -->
        <a href="" @click.stop='handle'>冒泡</a>
        <div class="outeer" @click='outer'>
            <div class="middle" @click='middle'>
                <button @click="inner">点击我(^_^)</button>
            </div>
        </div>
        <hr>
        <br>
        <br>
        <br>
        <br>
        <br>
        <!-- 阻止事件冒泡 button冒泡到div上面去了-->
        <div @click="show(message,$event)">
            <button @click.stop="show(message,$event)">点击我</button>
            <a href="http://www.baidu.com" @click.prevent.stop="show(message,$event)">百度</a>
        </div>
    </div>
    <br>
    <br>
    <br>
    <hr>
    <div onclick="fun1(event)" style="height:100px;background-color:black;color:white;text-align:center;border:1px solid red">
        父节点
        <div onclick="fun2(event)" style="margin-top:20px;border:1px solid red;height:30px">
            子节点
        </div>
    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                url: "https:// www.baidu.com",
                message: 123,
            },
            methods: {
                // handle: function() {
                //     return window.alert('单击事件冒泡')
                // },
                show: function(message, event) {
                    window.alert('hello word');
                    console.log(this.message);
                    console.log('helo vue');
                }
            }
        });

        var fun1 = function(e) {
            alert("我是父点击事件");
        };
        var fun2 = function(e) {
            e.stopPropagation(); //阻止点击事件向上冒泡
            alert("我是子点击事件");
        }
    </script>
</body>

</html>